package net.starwifi.duobao.entity;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.Digits;
import javax.validation.constraints.Min;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 优惠券
 * Created by Administrator on 2016/2/4.
 */
@Entity
@Table(name = "duob_coupon")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "duob_coupon_sequence")
public class Coupon extends BaseEntity {


    /** 名称 */
    private String name;

    /** 前缀 */
    private String prefix;

    /** 使用起始日期 */
    private Date beginDate;

    /** 使用结束日期 */
    private Date endDate;

    /** 最小商品数量 */
    private Integer minimumQuantity;

    /** 最大商品数量 */
    private Integer maximumQuantity;

    /** 最小商品价格 */
    private BigDecimal minimumPrice;

    /** 最大商品价格 */
    private BigDecimal maximumPrice;

    /** 价格运算表达式 */
    private String priceExpression;

    /** 是否启用 */
    private Boolean isEnabled;

    /** 介绍 */
    private String introduction;

    /** 关联订单 */
    private Long orderId;

    /** 是否已经激活 */
    private Boolean isActivation;

    @NotEmpty
    @Length(max = 200)
    @Column(nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @NotEmpty
    @Length(max = 200)
    @Column(nullable = false)
    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    @Column
    public Date getBeginDate() {
        return beginDate;
    }

    public void setBeginDate(Date beginDate) {
        this.beginDate = beginDate;
    }

    @Column
    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    @Min(0)
    @Column
    public Integer getMinimumQuantity() {
        return minimumQuantity;
    }

    public void setMinimumQuantity(Integer minimumQuantity) {
        this.minimumQuantity = minimumQuantity;
    }

    @Min(0)
    @Column
    public Integer getMaximumQuantity() {
        return maximumQuantity;
    }

    public void setMaximumQuantity(Integer maximumQuantity) {
        this.maximumQuantity = maximumQuantity;
    }

    @Min(0)
    @Digits(integer = 12, fraction = 3)
    @Column(precision = 21, scale = 6)
    public BigDecimal getMinimumPrice() {
        return minimumPrice;
    }

    public void setMinimumPrice(BigDecimal minimumPrice) {
        this.minimumPrice = minimumPrice;
    }

    @Min(0)
    @Digits(integer = 12, fraction = 3)
    @Column(precision = 21, scale = 6)
    public BigDecimal getMaximumPrice() {
        return maximumPrice;
    }

    public void setMaximumPrice(BigDecimal maximumPrice) {
        this.maximumPrice = maximumPrice;
    }

    @Column
    public String getPriceExpression() {
        return priceExpression;
    }

    public void setPriceExpression(String priceExpression) {
        this.priceExpression = priceExpression;
    }

    @Column
    public Boolean getIsEnabled() {
        return isEnabled;
    }

    public void setIsEnabled(Boolean isEnabled) {
        this.isEnabled = isEnabled;
    }

    @Column
    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    @Column
    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    @Column
    public Boolean getIsActivation() {
        return isActivation;
    }

    public void setIsActivation(Boolean isActivation) {
        this.isActivation = isActivation;
    }


}
